package com.biz.controller.order;

import com.biz.model.Pmodel.order.PorderList;
import com.biz.service.home.HomeServiceI;
import com.framework.controller.BaseController;
import com.framework.model.Paging;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author lzq
 */
@Controller
@RequestMapping("/order")
public class OrderController extends BaseController{

    @Autowired
    private HomeServiceI homeService;

    /**
     * 跳转兑换列表
     */
    @RequestMapping("toOrder")
    public ModelAndView toOrder(ModelAndView mv){
        mv.setViewName("order/orderList");
        return mv;
    }


    /**
     * 加载兑换记录
     * @return
     */
    @RequestMapping("showOrderList")
    public void showOrderList(HttpServletResponse response, HttpServletRequest request)throws Exception{
        //前端封装的查询参数
        Map map = getParameterByRequest(request);

        Paging<PorderList> paging = homeService.queryOrderList(map);

        writeJson(paging, response);
    }
}
